﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Data;
using System.ComponentModel;

namespace StellarMedical
{
    public partial class ContentControl : UserControl, INotifyPropertyChanged
    {

        public event PropertyChangedEventHandler PropertyChanged;

        public UIElement ContentElement
        {
            get
            {
                return GetValue(ContentElementProperty) as UIElement;
            }

            set
            {
                SetValue(ContentElementProperty, value);
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("ContentElement"));
            }
        }

        public string HeaderString
        {
            get
            {
                return (string)GetValue(HeadStringProperty);
            }

            set
            {
                SetValue(HeadStringProperty, value);

                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("HeaderString"));
            }
        }

        public static DependencyProperty ContentElementProperty = DependencyProperty.Register(
            "ContentElement", typeof(UIElement), typeof(ContentControl), new PropertyMetadata(null, OnContentElementChanged));

        private static void OnContentElementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            (d as ContentControl).ContentBorder.Child = e.NewValue as UIElement;
        }

        public static DependencyProperty HeadStringProperty = DependencyProperty.Register(
            "HeaderString", typeof(string), typeof(ContentControl), new PropertyMetadata("", OnHeaderStringChanged));

        private static void OnHeaderStringChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
        }


        public ContentControl()
        {
            InitializeComponent();
            this.DataContext = this;
        }
    }
}
